package com.education.teach;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.education.teach.mvp.ui.activity.LoginActivity;
import com.education.teach.utils.DnCommonUtils;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;

import dn.easy.common.bean.UserInfoEntity;
import dn.easy.common.commonutils.SPUtils;
import dn.easy.common.commonutils.StringUtils;
import dn.easy.common.constant.Contans;
import dn.easy.common.core.RouterHub;
import dn.easy.common.utils.SaveUserInfo;

/**
 * 闪屏页面
 */
public class SplashActivity extends BaseActivity {

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_splash;
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        jumpPage();
    }

    /**
     * 跳转页面
     **/
    private void jumpPage() {
        if (DnCommonUtils.getUserModel(this) == null)
            gotoLogin();
        else
            gotoMainActivity();
    }

    /**
     * 去首页
     **/
    private void gotoMainActivity() {
        ArmsUtils.startActivity(MainActivity.class);
        finish();
    }

    /**
     * 去登陆
     **/
    private void gotoLogin() {
//        ArmsUtils.startActivity(MainActivity.class);
        ArmsUtils.startActivity(LoginActivity.class);
        finish();
    }


}
